#include <IE.au3>
AutoItSetOption("SendKeyDelay", 50)
AutoItSetOption("WinSearchChildren", 1)
AutoItSetOption("WinTitleMatchMode", 2)
;$parameter = "";
$username = $cmdline[1]
$passworld = $cmdline[2]

If( $username = "") then 
   Beep(500,5000)
   MsgBox(true, "Error", "Can not find parameter")
EndIf
Local $oIE = _IECreate("www.facebook.com",0,1,1,1)
_IELoadWait($oIE)
WinWait("[CLASS:IEFrame]")
$handle = WinGetHandle("[CLASS:IEFrame]");Internet Explorer_Server

if($handle == 0) Then
   Beep(500,5000)
EndIf
WinWaitActive($handle)
WinMove($handle,"",0,0, 1200,1200)

_IENavigate($oIE, "www.facebook.com", 1)
Send($username)
Send("{TAB}")
Send($passworld)
Send("{ENTER}")
If @error Then
    Beep(500,5000)
    MsgBox(4096, "Error", "Could not find the correct window")
	Exit 1
 Else
    Exit $oIE
 EndIf

